package com.lx.regex;

import java.util.Date;
import java.util.Random;

public class timetest02 {
    public static void main(String[] args) {
        datedemo01();

        Random r = new Random();
//        for(int i=0;i<10;i++)
//        {
//            System.out.println(r.nextInt());
//        }
        Date d1 = new Date(Math.abs(r.nextInt()));
        Date d2 = new Date(Math.abs(r.nextInt()));
        long time1 = d1.getTime();
        long time2 = d2.getTime();
        if(time1<time2)
        {
            System.out.println("date2在前");
        }
        else
        {
            System.out.println("date1在前");
        }

    }

    private static void datedemo01() {
        Date d1 = new Date(0L);
        long time = d1.getTime();
        time = time + 1000L * 60 * 60 * 24 * 365;
        d1.setTime(time);
        System.out.println(d1);
    }
}
